﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IrisMembership.DomainClasses.Configurations
{
    public class PermissionConfig : EntityTypeConfiguration<Permission>
    {
        public PermissionConfig()
        {
            Property(p => p.PermissionName).HasMaxLength(200);
            Property(p => p.ControllerName).HasMaxLength(100);
            Property(p => p.ActionName).HasMaxLength(100);
            Property(p => p.AreaName).HasMaxLength(100);
            HasOptional(p => p.ParentPermission).WithMany(p => p.ChildrenPermissions).HasForeignKey(p => p.ParentPermissionId).WillCascadeOnDelete(false);
        }
    }
}
